import { createRequest } from '../index.js';

//查询教学周
export const getWeekList = () => {
  return createRequest({
    url: `/open/school-week/findCurrentSemesterWeeks`,
    method: 'get',
  })
}

// 学生任务列表
export const getStudentTaskList = data => {
  return createRequest({
    url: `/student/project-task/page`,
    method: 'get',
    params: data
  })
}

//学生根据id查询详情
export const getStudentTaskDetailById = id => {
  return createRequest({
    url: `/student/project-task/findById/${id}`,
    method: 'get',
  })
}

//学生提交任务
export const studentSubmitTask = ({data,id})=> {
  return createRequest({
    url: `/student/project-task/submitTask/${id}`,
    method: 'post',
    data
  })
}

//学生删除附件
export const studentDeleteFile = (fileId)=> {
  return createRequest({
    url: `/student/project-task/delFile/${fileId}`,
    method: 'post',
  })
}

// 教师任务列表
export const getTeacherTaskList = data => {
  return createRequest({
    url: `/teacher/project-task/page`,
    method: 'get',
    params: data
  })
}

// 教师批量添加任务
export const addTasks = ({projectId,data}) => {
  return createRequest({
    url: `/teacher/project-task/assignTasksBatch/${projectId}`,
    method: 'post',
    data
  })
}

// 教师端根据id查询任务详情
export const getTeacherTaskDetailById = (taskId) => {
  return createRequest({
    url: `/teacher/project-task/findById/${taskId}`,
    method: 'get',
  })
}

// 教师端删除任务
export const deleteTeacherTask = (data) => {
  return createRequest({
    url: `/teacher/project-task/delete`,
    method: 'delete',
    data
  })
}
// 教师发布/下线任务
export const modifyTaskStatus = ({status,data}) => {
  return createRequest({
    url: `/teacher/project-task/updateStatus/${status}`,
    method: 'post',
    data
  })
}

//教师端查询项目下所有学生
export const getAllStudent = (data) => {
  return createRequest({
    url: `/teacher/project-team/findTeamByProject`,
    method: 'get',
    params: data
  })
}

//教师端查询项目下某一组的所有学生
export const getGroupStudent = (data) => {
  return createRequest({
    url: `/teacher/project-team/myProjectStudentList`,
    method: 'get',
    params: data
  })
}

// 教师编辑任务
export const teacherModifyTasks = ({projectId,data}) => {
  return createRequest({
    url: `/teacher/project-task/assignTasks/${projectId}`,
    method: 'post',
		data
  })
}